﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.IO;
using System.Net;

namespace HtmlTo.LayoutEngine
{
    /// <summary>
    /// <para>HTML Document interface</para>
    /// </summary>
    public abstract class LayoutDocument : LayoutNode
    {
        #region Properties

        /// <summary>
        /// <para>Document Title</para>
        /// </summary>
        public string Title { get; set; }

        #endregion

        #region Methods

        /// <summary>
        /// <para>Load HTML from the passed string</para>
        /// </summary>
        /// <param name="html">HTML string</param>
        public abstract void Load(string html);

        /// <summary>
        /// <para>Load HTML from the passed URL</para>
        /// </summary>
        /// <param name="Url">URL</param>
        public void LoadFromUrl(string url)
        {
            WebClient webClient = new WebClient();
            using (StreamReader reader = new StreamReader(webClient.OpenRead(url)))
            {

                this.Load(reader.ReadToEnd());
            }
        }


        #endregion
    }
}
